package com.chenggcode.simple.aop.services.impl;

import com.chenggcode.simple.aop.annotations.Annotation1;
import com.chenggcode.simple.aop.services.TestAopContextService;
import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Service;

/**
 * @author Chenggcode
 * @date 2025/6/18 16:19
 */
@Service
@RequiredArgsConstructor
public class TestAopContextServiceImpl implements TestAopContextService {

    @Override
    public void m1() {
        System.out.println("m1 method executed");
        // 可以在这里调用其他方法，或者进行其他业务逻辑处理
        TestAopContextService p = (TestAopContextService) AopContext.currentProxy();
        p.m2();
    }

    @Override
    @Annotation1
    public void m2() {
        System.out.println("m2 method executed");
    }
}
